#include "DBManager/Repository/HDF5/Input/Element/CTRIA6Repository.h"
#include "DBManager/Repository/HDF5/Base/HDF5RepositoryMacro.h"

// 关键：注册CTRIA6Repository到数据库（CTRIA3也有此宏，否则数据库找不到仓库）
HDF5_REG_ELEMENT_REPOSITORY (CTRIA6Repository)

using namespace SG::DBManager::HDF5;
using namespace SG::DataStructure::FEM;

CTRIA6Repository::CTRIA6Repository (HDF5Database& database) : MpiRepositoryBase<CTRIA6Data> (database)
{}

void CTRIA6Repository::InitialDatasetInfo ()
{
    RegisterIndex ("/OWN/INDEX/INPUT/ELEMENT/CTRIA6", IndexDataset, GetType ());
    RegisterTableInfo<CTRIA6Data> ("/SG/INPUT/ELEMENT/CTRIA6", MainDataset);

    // 连接信号槽 当调用汇总的时候，将已有的缓存信息全部都持久化到HDF5文件中。
    GetDatabase ().GetHDF5Hub()->m_elementSummarySignal.connect ([this] { Sort (); });
    GetDatabase ().GetHDF5Hub ()->ConnectFindElementNodes (
        GetType (), [this] (SG::DataStructure::Common::Id eid) 
        { 
            return FindElementNodes (this, eid);  
        });
}